@include('admin.layout.css')
@include('admin.layout.js')




<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">


    <div class="layui-form-item">
        <label class="layui-form-label"> 店铺号码</label>
        <div class="layui-input-inline">
            <input type="text"  name="shop_nums" value="{{$user_info['shop_nums']}}"  placeholder="请输入店铺号码" autocomplete="off" class="layui-input" >
        </div>
    </div>


    <input type="hidden" name="user_id" value="{{$user_info['user_id']}}">


    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="submit" id="submit" value="确认">
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="取消">
    </div>

</div>


<script>



    UI.upload('#test1',function (res) {
        if (res.code !== 200) {
            Utils.errorToast(res.msg);
        }else{
            Utils.successToast('上传成功');
            $('#img_url_show').attr('src',res['data']['src']);
            $('#img_url').val(res['data']['src']);
        }
    });

    layui.use(['laydate','form'], function() {
        let form = layui.form;


        form.on('select(selectChange)', function(data){
            // 获取被选中的值
            var value = data.value;
            // 在这里执行你需要的操作...
            HttpUtils.get("{{route('admin.areas.childs')}}?parentid="+value,{},function (resultData){
                $("#area_id").empty();
                $("#quyu_id").empty();
                $("#xiangzhen_id").empty();

                $("#area_id").append("<option value=''>请选择</option>")
                for(let i = 0;i<resultData['data'].length;i++){
                    console.log(resultData['data'][i]['name'])
                    $("#area_id").append("<option value='"+resultData['data'][i]['area_id']+"'>"+resultData['data'][i]['name']+"</options>");
                }
                form.render()
            });

        });

        form.on('select(selectChange1)', function(data){
            // 获取被选中的值
            let value = data.value;
            // 在这里执行你需要的操作...
            HttpUtils.get("{{route('admin.areas.childs')}}?parentid="+value,{},function (resultData){
                $("#quyu_id").empty();
                $("#xiangzhen_id").empty();

                $("#quyu_id").append("<option value=''>请选择</option>")
                for(let i = 0;i<resultData['data'].length;i++){
                    console.log(resultData['data'][i]['name'])
                    $("#quyu_id").append("<option value='"+resultData['data'][i]['area_id']+"'>"+resultData['data'][i]['name']+"</options>");
                }
                form.render()
            });
        });

        form.on('select(selectChange2)', function(data){
            // 获取被选中的值
            let value = data.value;
            // 在这里执行你需要的操作...
            HttpUtils.get("{{route('admin.areas.childs')}}?parentid="+value,{},function (resultData){
                $("#xiangzhen_id").empty();

                $("#xiangzhen_id").append("<option value=''>请选择</option>")
                for(let i = 0;i<resultData['data'].length;i++){
                    console.log(resultData['data'][i]['name'])
                    $("#xiangzhen_id").append("<option value='"+resultData['data'][i]['area_id']+"'>"+resultData['data'][i]['name']+"</options>");
                }
                form.render()
            });
        });

        form.on('submit(submit)', function(data){
            Api.add("{{route('admin.users.set_shop')}}",data.field,function(res){
                if (res.code !== 200){
                    Utils.errorToast(res.msg);
                    return;
                }
            });
        });


    });
</script>
